package com.android.qjpmc.widget.retrofithelper.rxexception;

import com.alibaba.fastjson.JSONObject;
import com.android.qjpmc.widget.bean.BaseRequestData;

/**
 * Created by Mloong on 2018/7/31.
 */

public class HttpNativeException extends RuntimeException {
    private String message;
    private String jsonData;
    private int code;

    public HttpNativeException(int code, String message, String jsonData) {
        super(message);
        this.code = code;
        this.message = message;
        this.jsonData = jsonData;
    }

    public int getCode() {
        return code;
    }

    public String getJsonData() {
        return jsonData;
    }

    public BaseRequestData getNetData() {
        try {

            return JSONObject.parseObject(getJsonData(), BaseRequestData.class);
        } catch (com.alibaba.fastjson.JSONException e) {
            return null;
        }
    }
}
